<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Parsing Type Data</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Parsing Type Data' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">assertions</a></li><li><a href="index.html#5">Chapter 5: Imperative Code</a></li><li><b>Parsing Type Data</b></li></ul></div>
<p class="purpose">To parse the prototype text of a To... phrase into its type data.</p>

<ul class="toc"><li><a href="5-ptd2.html#SP1">&#167;1. Introduction</a></li><li><a href="5-ptd2.html#SP2">&#167;2. Return data</a></li><li><a href="5-ptd2.html#SP4">&#167;4. Doodads</a></li><li><a href="5-ptd2.html#SP8">&#167;8. Prototype body</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Introduction.</b>This section provides just one function to the rest of Inform, <a href="5-ptd2.html#SP1" class="internal">ParsingIDTypeData::parse</a>,
but it's a doozy. It parses the prototype text of a "To..." phrase into a complete and
correct set of type data for it. Recall that the prototype includes the initial word
"to", as in this example. We divide it further into a front part which gives the
return data; the middle main part, giving the wording needed to invoke the phrase;
and some annotations at the end, called doodads.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">To</span><span class="plain-syntax"> </span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">number</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">number</span><span class="plain-syntax">) </span><span class="identifier-syntax">doubled</span><span class="plain-syntax"> (</span><span class="identifier-syntax">deprecated</span><span class="plain-syntax">) , </span><span class="identifier-syntax">slowly</span><span class="plain-syntax"> </span><span class="identifier-syntax">or</span><span class="plain-syntax"> </span><span class="identifier-syntax">quickly</span>
<span class="plain-syntax">&lt;--------------------------------- </span><span class="identifier-syntax">prototype</span><span class="plain-syntax"> -----------------------------------&gt;</span>
<span class="plain-syntax">&lt;-- </span><span class="identifier-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">data</span><span class="plain-syntax"> --------&gt; &lt;-- </span><span class="identifier-syntax">main</span><span class="plain-syntax"> </span><span class="identifier-syntax">prototype</span><span class="plain-syntax"> --&gt; &lt;- </span><span class="identifier-syntax">doodads</span><span class="plain-syntax"> -&gt;  &lt;--- </span><span class="identifier-syntax">options</span><span class="plain-syntax"> ---&gt;</span>
</pre>
<p class="commentary">If we detect phrase options, after a comma, we pass the word range for them
back. The IDTD we write to is factory-fresh except that it has already been
adjusted for an inline definition (if that's the kind of definition this is).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingIDTypeData::parse</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">ParsingIDTypeData::parse</span></span>:<br/>To Phrase Family - <a href="5-tpf.html#SP7">&#167;7</a>, <a href="5-tpf.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">XW</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">say_flag</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="comment-syntax"> is this going to be a "say" phrase?</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><a href="5-ptd2.html#SP3" class="function-link"><span class="function-syntax">ParsingIDTypeData::phtd_parse_return_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">);        </span><span class="comment-syntax"> trim return from the front</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DocReferences::position_of_symbol</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);                   </span><span class="comment-syntax"> trim doc ref from the back</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><a href="5-ptd2.html#SP6" class="function-link"><span class="function-syntax">ParsingIDTypeData::phtd_parse_doodads</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">say_flag</span><span class="plain-syntax">); </span><span class="comment-syntax"> and doodads from the back</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">; </span><span class="comment-syntax"> the options wording</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cw</span><span class="plain-syntax"> = -1; </span><span class="comment-syntax"> word number of first comma</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP1_1" class="named-paragraph-link"><span class="named-paragraph">Find the first comma outside of parentheses, if any exists</span><span class="named-paragraph-number">1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cw</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">comma_presages_options</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP1_2" class="named-paragraph-link"><span class="named-paragraph">Does this comma presage phrase options?</span><span class="named-paragraph-number">1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">comma_presages_options</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">say_flag</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP1_3" class="named-paragraph-link"><span class="named-paragraph">Issue a problem: say phrases aren't allowed options</span><span class="named-paragraph-number">1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">, </span><span class="identifier-syntax">cw</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">, </span><span class="identifier-syntax">cw</span><span class="plain-syntax"> - </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="comment-syntax"> trim preamble range to text before the comma</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">registration_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">XW</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="5-ptd2.html#SP9" class="function-link"><span class="function-syntax">ParsingIDTypeData::phtd_main_prototype</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="5-po.html#SP6" class="function-link"><span class="function-syntax">PhraseOptions::parse_declared_options</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">options_data</span><span class="plain-syntax">), </span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP1_1" class="paragraph-anchor"></a><b>&#167;1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find the first comma outside of parentheses, if any exists</span><span class="named-paragraph-number">1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bl</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_WORDING</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">OPENBRACE_V</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">OPENBRACKET_V</span><span class="plain-syntax">)) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACE_V</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACKET_V</span><span class="plain-syntax">)) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="identifier-syntax">COMMA_V</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">bl</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;</span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">))) { </span><span class="identifier-syntax">cw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_2" class="paragraph-anchor"></a><b>&#167;1.2. </b>In some control structures, comma is implicitly a sort of "then".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Does this comma presage phrase options?</span><span class="named-paragraph-number">1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="function-syntax">&lt;control-structure-phrase&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">ControlStructures::comma_possible</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">comma_presages_options</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP1_3" class="paragraph-anchor"></a><b>&#167;1.3. </b>If you find the explanation in this message unconvincing, you're not alone.
To be honest my preferred fix would be to delete phrase options from the
language altogether, but there we are; spilt milk.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue a problem: say phrases aren't allowed options</span><span class="named-paragraph-number">1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_SayWithPhraseOptions</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"phrase options are not allowed for 'say' phrases"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"because the commas would lead to ambiguous sentences, and because the content of a "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"substitution is intended to be something conceptually simple and not needing "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"clarification."</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP1">&#167;1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Return data.</b>As with C type declarations for functions, Inform phrase prototypes put their
return kinds up at the front, not the back. So we'll parse that first.
</p>

<p class="commentary">Note that &lt;k-kind-prototype&gt; parses &lt;k-kind&gt;, but in a mode which causes
the kind variables to be read as formal prototypes and not as their values.
This allows for tricky definitions like:
</p>

<blockquote>
    <p>To decide which K is (name of kind of value K) which relates to (Y - L) by (R - relation of Ks to values of kind L)</p>
</blockquote>

<p class="commentary">where &lt;k-kind-prototype&gt; needs to recognise "K" even though the tokens
haven't yet been parsed, so that we don't yet know it will be meaningful.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">DEC_RANN</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DEV_RANN</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TOC_RANN</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TOV_RANN</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TO_RANN</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;to-return-data&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> {</span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">yes</span><span class="plain-syntax">/</span><span class="identifier-syntax">no</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> {</span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> ...} |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">whether</span><span class="plain-syntax">/</span><span class="reserved-syntax">if</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">whether</span><span class="plain-syntax">/</span><span class="reserved-syntax">if</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">what</span><span class="plain-syntax">/</span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;return-kind&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="identifier-syntax">decide</span><span class="plain-syntax"> </span><span class="identifier-syntax">what</span><span class="plain-syntax">/</span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;return-kind&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">to</span><span class="plain-syntax"> ...</span>

<span class="function-syntax">&lt;return-kind&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_UnknownValueToDecide problem</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_UnknownValueToDecide</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="string-syntax">"The phrase you describe in %1 seems to be trying to decide a value, "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"but '%2' is not a kind that I recognise. (I had expected something "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"like 'number' or 'object' - see the Kinds index for what's available.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    ==&gt; { -, </span><span class="identifier-syntax">K_number</span><span class="plain-syntax">};</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>A curiosity here is that exactly one phrase definition is allowed to decide
a truth state: "To decide what truth state is whether or not (C - condition)",
from Basic Inform. So we throw a problem only on subsequent tries.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_truth_state_decisions_allowed</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingIDTypeData::phtd_parse_return_data</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">ParsingIDTypeData::phtd_parse_return_data</span></span>:<br/><a href="5-ptd2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">XW</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;to-return-data&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;to-return-data&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mor</span><span class="plain-syntax"> = -1; </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEC_RANN:</span><span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEV_RANN:</span><span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOC_RANN:</span><span class="plain-syntax"> </span><span class="identifier-syntax">mor</span><span class="plain-syntax"> = </span><span class="constant-syntax">DECIDES_CONDITION_MOR</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOV_RANN:</span><span class="plain-syntax"> </span><span class="identifier-syntax">mor</span><span class="plain-syntax"> = </span><span class="constant-syntax">DECIDES_VALUE_MOR</span><span class="plain-syntax">; </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TO_RANN:</span><span class="plain-syntax">  </span><span class="identifier-syntax">mor</span><span class="plain-syntax"> = </span><span class="constant-syntax">DECIDES_NOTHING_MOR</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">mor</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><a href="5-ptd.html#SP10" class="function-link"><span class="function-syntax">IDTypeData::set_mor</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">mor</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDERR</span><span class="plain-syntax">, </span><span class="string-syntax">"XW = %W\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"to phrase without to"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">return_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_truth_state</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">no_truth_state_decisions_allowed</span><span class="plain-syntax">++ &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TruthStateToDecide</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"phrases are not allowed to decide a truth state"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"and should be defined with the form 'To decide if ...' rather than "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"'To decide what truth state is ...'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">XW</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Doodads.</b>These are the optional annotations placed at the end of the prototype but which
are not part of what has to be matched. (They're mostly relevant only for inline
definitions of basic language constructs, so many Inform users know nothing of
the syntax below.)
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SAY_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LET_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">BLOCK_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">IN_LOOP_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">IN_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONDITIONAL_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">6</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LOOP_ANN</span><span class="plain-syntax"> </span><span class="constant-syntax">7</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;phrase-preamble&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;phrase-preamble&gt;</span><span class="plain-syntax"> ( </span><span class="identifier-syntax">deprecated</span><span class="plain-syntax"> ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">  |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;to-preamble&gt;</span>

<span class="function-syntax">&lt;to-preamble&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;to-preamble&gt;</span><span class="plain-syntax"> ( </span><span class="identifier-syntax">arithmetic</span><span class="plain-syntax"> </span><span class="identifier-syntax">operation</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;to-preamble&gt;</span><span class="plain-syntax"> ( </span><span class="identifier-syntax">assignment</span><span class="plain-syntax"> </span><span class="identifier-syntax">operation</span><span class="plain-syntax"> ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;to-preamble&gt;</span><span class="plain-syntax"> ( </span><span class="identifier-syntax">offset</span><span class="plain-syntax"> </span><span class="identifier-syntax">assignment</span><span class="plain-syntax"> </span><span class="identifier-syntax">operation</span><span class="plain-syntax"> ) |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">let</span><span class="plain-syntax"> ... </span><span class="identifier-syntax">be</span><span class="plain-syntax"> </span><span class="identifier-syntax">given</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> ...} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">let</span><span class="plain-syntax"> ...} |</span>
<span class="plain-syntax">    ... -- </span><span class="identifier-syntax">end</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ... -- </span><span class="identifier-syntax">end</span><span class="plain-syntax"> </span><span class="identifier-syntax">conditional</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ... -- </span><span class="identifier-syntax">end</span><span class="plain-syntax"> </span><span class="identifier-syntax">loop</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ... -- </span><span class="identifier-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">loop</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ... -- </span><span class="identifier-syntax">in</span><span class="plain-syntax"> ### |</span>
<span class="plain-syntax">    ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Phrases whose definitions begin "To say" are usually but not necessarily text
substitutions.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NO_SANN</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONTROL_SANN</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">BEGIN_SANN</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONTINUE_SANN</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ENDM_SANN</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">END_SANN</span><span class="plain-syntax"> </span><span class="constant-syntax">6</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;say-preamble&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax"> -- </span><span class="identifier-syntax">running</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> </span><span class="identifier-syntax">otherwise</span><span class="plain-syntax">/</span><span class="reserved-syntax">else</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> </span><span class="identifier-syntax">otherwise</span><span class="plain-syntax">/</span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax">/</span><span class="identifier-syntax">unless</span><span class="plain-syntax"> ...} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax">/</span><span class="identifier-syntax">unless</span><span class="plain-syntax"> ...} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> </span><span class="identifier-syntax">end</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax">/</span><span class="identifier-syntax">unless</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> ...} -- </span><span class="identifier-syntax">beginning</span><span class="plain-syntax"> ### |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> ...} -- </span><span class="identifier-syntax">continuing</span><span class="plain-syntax"> ### |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> ...} -- </span><span class="identifier-syntax">ending</span><span class="plain-syntax"> ### </span><span class="identifier-syntax">with</span><span class="plain-syntax"> </span><span class="identifier-syntax">marker</span><span class="plain-syntax"> ### |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> ...} -- </span><span class="identifier-syntax">ending</span><span class="plain-syntax"> ### |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">say</span><span class="plain-syntax"> ...}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>Since doodads are notated at the back of the prototype text, the following trims
the end off the wording given.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingIDTypeData::phtd_parse_doodads</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">ParsingIDTypeData::phtd_parse_doodads</span></span>:<br/><a href="5-ptd2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">say_flag</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;&lt;operation&gt;&gt;</span><span class="plain-syntax"> = -1; </span><span class="function-syntax">&lt;&lt;assign&gt;&gt;</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="function-syntax">&lt;&lt;offset&gt;&gt;</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;&lt;deprecated&gt;&gt;</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="function-syntax">&lt;&lt;run-on&gt;&gt;</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;phrase-preamble&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">); </span><span class="comment-syntax"> guaranteed to match any non-empty text</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax"> == </span><span class="constant-syntax">SAY_ANN</span><span class="plain-syntax">) </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;to-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;deprecated&gt;&gt;</span><span class="plain-syntax">) </span><a href="5-ptd.html#SP16" class="function-link"><span class="function-syntax">IDTypeData::deprecate_phrase</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">let</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">blk</span><span class="plain-syntax"> = </span><span class="constant-syntax">NO_BLOCK_FOLLOWS</span><span class="plain-syntax">, </span><span class="identifier-syntax">only_in</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="comment-syntax"> "nothing unusual" defaults</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">BLOCK_ANN:</span><span class="plain-syntax">         </span><span class="identifier-syntax">blk</span><span class="plain-syntax"> = </span><span class="constant-syntax">MISCELLANEOUS_BLOCK_FOLLOWS</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONDITIONAL_ANN:</span><span class="plain-syntax">   </span><span class="identifier-syntax">blk</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONDITIONAL_BLOCK_FOLLOWS</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">IN_ANN:</span><span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Set only-in to the first keyword</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">IN_LOOP_ANN:</span><span class="plain-syntax">       </span><span class="identifier-syntax">only_in</span><span class="plain-syntax"> = -1; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">LET_ANN:</span><span class="plain-syntax">           </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;eqn&gt;&gt;</span><span class="plain-syntax">) </span><span class="identifier-syntax">let</span><span class="plain-syntax"> = </span><span class="constant-syntax">EQUATION_LET_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">let</span><span class="plain-syntax"> = </span><span class="constant-syntax">ASSIGNMENT_LET_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                                </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOOP_ANN:</span><span class="plain-syntax">          </span><span class="identifier-syntax">blk</span><span class="plain-syntax"> = </span><span class="constant-syntax">LOOP_BODY_BLOCK_FOLLOWS</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SAY_ANN:</span><span class="plain-syntax">           </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP6_2" class="named-paragraph-link"><span class="named-paragraph">We seem to be parsing a "say" phrase</span><span class="named-paragraph-number">6.2</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="5-ptd.html#SP21" class="function-link"><span class="function-syntax">IDTypeData::make_id</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">), </span><span class="function-syntax">&lt;&lt;operation&gt;&gt;</span><span class="plain-syntax">, </span><span class="function-syntax">&lt;&lt;assign&gt;&gt;</span><span class="plain-syntax">, </span><span class="function-syntax">&lt;&lt;offset&gt;&gt;</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">let</span><span class="plain-syntax">, </span><span class="identifier-syntax">blk</span><span class="plain-syntax">, </span><span class="identifier-syntax">only_in</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP6_3" class="named-paragraph-link"><span class="named-paragraph">Vet the phrase for an unfortunate prepositional collision</span><span class="named-paragraph-number">6.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b>For example, if the preamble is "To while...", then this sets <span class="extract"><span class="extract-syntax">only_in</span></span>
to the word number of "while".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Set only-in to the first keyword</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;to-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">only_in</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b>And similarly for the say annotations.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">We seem to be parsing a "say" phrase</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    *</span><span class="identifier-syntax">say_flag</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">cs</span><span class="plain-syntax"> = -1, </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = -1, </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = -1, </span><span class="identifier-syntax">cat</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;say-ann&gt;&gt;</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONTROL_SANN:</span><span class="plain-syntax">  </span><span class="identifier-syntax">cs</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;control&gt;&gt;</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">BEGIN_SANN:</span><span class="plain-syntax">    </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="constant-syntax">SSP_START</span><span class="plain-syntax">; </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONTINUE_SANN:</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="constant-syntax">SSP_MIDDLE</span><span class="plain-syntax">; </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ENDM_SANN:</span><span class="plain-syntax">     </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="constant-syntax">SSP_END</span><span class="plain-syntax">; </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">); </span><span class="identifier-syntax">cat</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">END_SANN:</span><span class="plain-syntax">      </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="constant-syntax">SSP_END</span><span class="plain-syntax">; </span><span class="identifier-syntax">XW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;say-preamble&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">XW</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="5-ptd.html#SP19" class="function-link"><span class="function-syntax">IDTypeData::make_sd</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_say</span><span class="plain-syntax">), </span><span class="function-syntax">&lt;&lt;run-on&gt;&gt;</span><span class="plain-syntax">, </span><span class="identifier-syntax">cs</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">at</span><span class="plain-syntax">, </span><span class="identifier-syntax">cat</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3" class="paragraph-anchor"></a><b>&#167;6.3. </b>The definition remaining after the preamble is removed is then vetted.
This is a possibly controversial point, in fact, because the check in question
is not actually needed. But a definition violating this would be unlikely to
work as the author hoped, and would almost certainly throw a cascade of other
but less helpful problem messages.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Vet the phrase for an unfortunate prepositional collision</span><span class="named-paragraph-number">6.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="function-syntax">&lt;phrase-vetting&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;phrase-vetting&gt;</span>
<span class="plain-syntax">    ( ...... ) </span><span class="function-syntax">&lt;copular-verb&gt;</span><span class="plain-syntax"> {</span><span class="function-syntax">&lt;copular-preposition&gt;</span><span class="plain-syntax">} ( ...... )</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_MasksRelation</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">RW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-vetting&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">preposition</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prep</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RP</span><span class="plain-syntax">[2];</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Prepositions::get_where_pu_created</span><span class="plain-syntax">(</span><span class="identifier-syntax">prep</span><span class="plain-syntax">) == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_text</span><span class="plain-syntax">(4, </span><span class="string-syntax">"This is a relation defined inside Inform."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(4, </span><span class="identifier-syntax">Prepositions::get_where_pu_created</span><span class="plain-syntax">(</span><span class="identifier-syntax">prep</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(3, </span><span class="identifier-syntax">RW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_MasksRelation</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="string-syntax">"I don't want you to define a phrase with the wording you've used in "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"in %1 because it could be misunderstood. There is already a definition "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"of what it means for something to be '%3' something else, so this "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"phrase definition would look too much like testing whether "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"'X is %3 Y'. (%4.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    ==&gt; { -, </span><span class="identifier-syntax">K_number</span><span class="plain-syntax"> };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Prototype body.</b>The main part of the prototype is in the middle, but is parsed last.
</p>

<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>At this final stage of parsing, all annotations to do with inline or say
behaviour have been stripped away, and what's left is the text which will
form the word and token sequences:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingIDTypeData::phtd_main_prototype</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">ParsingIDTypeData::phtd_main_prototype</span></span>:<br/><a href="5-ptd2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">id_type_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">registration_text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">word_to_add</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="comment-syntax"> redundant assignment to keep </span><span class="extract"><span class="extract-syntax">gcc</span></span><span class="comment-syntax"> happy</span>
<span class="plain-syntax">        </span><span class="function-syntax">&lt;phrase-definition-word-or-token&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">NOT_APPLICABLE:</span><span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">; </span><span class="comment-syntax"> a problem message has been issued</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE:</span><span class="plain-syntax">              </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_2" class="named-paragraph-link"><span class="named-paragraph">Add a token next</span><span class="named-paragraph-number">9.2</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE:</span><span class="plain-syntax">             </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_1" class="named-paragraph-link"><span class="named-paragraph">Add a word next</span><span class="named-paragraph-number">9.1</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_WORDS_PER_PHRASE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PhraseTooLong</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this phrase has too many words"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"and needs to be simplified."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">registration_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">word_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_words</span><span class="plain-syntax">++] = </span><span class="identifier-syntax">word_to_add</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_3" class="named-paragraph-link"><span class="named-paragraph">Sort out the kind variables in this declaration</span><span class="named-paragraph-number">9.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9_1" class="paragraph-anchor"></a><b>&#167;9.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add a word next</span><span class="named-paragraph-number">9.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">word_to_add</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9">&#167;9</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_2" class="paragraph-anchor"></a><b>&#167;9.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add a token next</span><span class="named-paragraph-number">9.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">C</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;token-construct&gt;&gt;</span><span class="plain-syntax">, </span><span class="identifier-syntax">name_supplied</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">C</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">C</span><span class="plain-syntax"> = -</span><span class="identifier-syntax">C</span><span class="plain-syntax">; </span><span class="identifier-syntax">name_supplied</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">C</span><span class="plain-syntax"> == </span><span class="constant-syntax">ERRONEOUS_IDTC</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">; </span><span class="comment-syntax"> a problem message has been issued</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">; </span><span class="comment-syntax"> what is to be matched</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">TW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">name_supplied</span><span class="plain-syntax">) </span><span class="identifier-syntax">TW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="comment-syntax"> the name</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-definition-word-or-token&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">)); </span><span class="comment-syntax"> move past this token</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_2_2" class="named-paragraph-link"><span class="named-paragraph">Unless we are inline, phrase tokens have to be or describe values</span><span class="named-paragraph-number">9.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_2_3" class="named-paragraph-link"><span class="named-paragraph">Phrase tokens cannot be quantified</span><span class="named-paragraph-number">9.2.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_2_1" class="named-paragraph-link"><span class="named-paragraph">Fashion a suitable phrase token</span><span class="named-paragraph-number">9.2.1</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9">&#167;9</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_2_1" class="paragraph-anchor"></a><b>&#167;9.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Fashion a suitable phrase token</span><span class="named-paragraph-number">9.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">id_type_token</span><span class="plain-syntax"> </span><span class="identifier-syntax">pht</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::set_spec</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">pht</span><span class="plain-syntax">, </span><span class="identifier-syntax">spec</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pht</span><span class="plain-syntax">.</span><span class="element-syntax">construct</span><span class="plain-syntax"> = </span><span class="identifier-syntax">C</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pht</span><span class="plain-syntax">.</span><span class="element-syntax">token_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TW</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">word_to_add</span><span class="plain-syntax"> = </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax"> == </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="constant-syntax">MAX_TOKENS_PER_PHRASE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_number</span><span class="plain-syntax">(3, &amp;</span><span class="identifier-syntax">n</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TooManyTokens</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="string-syntax">"In %1, I ran out of tokens when I got up to '%2'. "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"Phrases are only allowed %3 tokens, that is, they "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"are only allowed %3 bracketed parts in their definitions."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">] = </span><span class="identifier-syntax">pht</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9_2">&#167;9.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_2_2" class="paragraph-anchor"></a><b>&#167;9.2.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Unless we are inline, phrase tokens have to be or describe values</span><span class="named-paragraph-number">9.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">C</span><span class="plain-syntax"> != </span><span class="constant-syntax">STANDARD_IDTC</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">C</span><span class="plain-syntax"> != </span><span class="constant-syntax">KIND_NAME_IDTC</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">as_inline</span><span class="plain-syntax">.</span><span class="element-syntax">invoked_inline_not_as_call</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_NoninlineUsesNonvalues</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="string-syntax">"In %1, the text '%2' after the hyphen should tell me what kind of "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"value goes here (like 'a number', or 'a vehicle'), but this is not "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"a kind: it does describe something I can understand, but not "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"something which can then be used as a value. (It would be allowed "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"in low-level, so-called 'inline' phrase definitions, but not in a "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"standard phrase definition like this one.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9_2">&#167;9.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_2_3" class="paragraph-anchor"></a><b>&#167;9.2.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Phrase tokens cannot be quantified</span><span class="named-paragraph-number">9.2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Specifications::is_description</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pcalc_prop</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prop</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Descriptions::to_proposition</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Binding::number_free</span><span class="plain-syntax">(</span><span class="identifier-syntax">prop</span><span class="plain-syntax">) != </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Spec is: $T\nProposition is: $D\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">spec</span><span class="plain-syntax">, </span><span class="identifier-syntax">prop</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_PhraseTokenQuantified</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><span class="string-syntax">"In %1, the text '%2' after the hyphen should tell me what kind of "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"value goes here (like 'a number', or 'a vehicle'), but it has to "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"be a single value, and not a description of what might be multiple "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"values. So 'N - a number' is fine, but not 'N - three numbers' or "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"'N - every number'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::is</span><span class="plain-syntax">(</span><span class="identifier-syntax">spec</span><span class="plain-syntax">, </span><span class="identifier-syntax">TEST_VALUE_NT</span><span class="plain-syntax">)) </span><span class="identifier-syntax">spec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">spec</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9_2">&#167;9.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_3" class="paragraph-anchor"></a><b>&#167;9.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Sort out the kind variables in this declaration</span><span class="named-paragraph-number">9.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">declarations</span><span class="plain-syntax">[27];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">usages</span><span class="plain-syntax">[27];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=1; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=26; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) { </span><span class="identifier-syntax">usages</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">t</span><span class="plain-syntax"> += </span><a href="5-ptd2.html#SP10" class="function-link"><span class="function-syntax">ParsingIDTypeData::find_kind_variable_domains</span></a><span class="plain-syntax">(</span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">usages</span><span class="plain-syntax">, </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">problem_thrown</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">v</span><span class="plain-syntax">=1; (</span><span class="identifier-syntax">v</span><span class="plain-syntax">&lt;=26) &amp;&amp; (</span><span class="identifier-syntax">problem_thrown</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">); </span><span class="identifier-syntax">v</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">usages</span><span class="plain-syntax">[</span><span class="identifier-syntax">v</span><span class="plain-syntax">] &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">declarations</span><span class="plain-syntax">[</span><span class="identifier-syntax">v</span><span class="plain-syntax">] == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_3_1" class="named-paragraph-link"><span class="named-paragraph">Issue a problem for an undeclared kind variable</span><span class="named-paragraph-number">9.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">problem_thrown</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;idtd-&gt;</span><span class="element-syntax">no_tokens</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::token_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                    </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP9_3_2" class="named-paragraph-link"><span class="named-paragraph">Substitute for any kind variables in the match specification</span><span class="named-paragraph-number">9.3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9">&#167;9</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_3_1" class="paragraph-anchor"></a><b>&#167;9.3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue a problem for an undeclared kind variable</span><span class="named-paragraph-number">9.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_UndeclaredKindVariable</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"this phrase uses a kind variable which is not declared"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"which is not allowed."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="5-ptd.html#SP3" class="function-link"><span class="function-syntax">IDTypeData::set_spec</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">token_sequence</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]),</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Descriptions::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">Kinds::binary_con</span><span class="plain-syntax">(</span><span class="identifier-syntax">CON_phrase</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_value</span><span class="plain-syntax">), </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">problem_thrown</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9_3">&#167;9.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9_3_2" class="paragraph-anchor"></a><b>&#167;9.3.2. </b>This following process is much less mysterious than it sounds. Suppose we
have the phrase:
</p>

<blockquote>
    <p>To add (purchase - K) to (shopping list - list of arithmetic values of kind K): ...</p>
</blockquote>

<p class="commentary">This tells us that the matcher should accept any list of arithmetic values,
and then set K equal to the kind of the entries, and require that the purchase
agree. According to the <span class="extract"><span class="extract-syntax">declarations</span></span> array already made, K is declared as a
kind of "arithmetic value". What the code in this paragraph does is to change
the <span class="extract"><span class="extract-syntax">to_match</span></span> specifications as if the phrase had read:
</p>

<blockquote>
    <p>To add (purchase - arithmetic value) to (shopping list - list of arithmetic values): ...</p>
</blockquote>

<p class="commentary">In other words, we substitute "arithmetic value" in place of K, and thus get
rid of variables from the match specifications entirely. We can safely do
this because the <span class="extract"><span class="extract-syntax">token_kind</span></span> for these two tokens remain
"K" and "list of K" respectively.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Substitute for any kind variables in the match specification</span><span class="named-paragraph-number">9.3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="5-ptd.html#SP4" class="function-link"><span class="function-syntax">IDTypeData::substitute_spec</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">idtd</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP9_3">&#167;9.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>The looks through a kind, returning the number of kind variables it finds. For
lots of straightforward kinds, such as "list of numbers", it returns 0.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ParsingIDTypeData::find_kind_variable_domains</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">ParsingIDTypeData::find_kind_variable_domains</span></span>:<br/><a href="5-ptd2.html#SP9_3">&#167;9.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">usages</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> **</span><span class="identifier-syntax">declarations</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Kinds::get_variable_number</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">t</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="5-ptd2.html#SP10_1" class="named-paragraph-link"><span class="named-paragraph">A kind variable has been found</span><span class="named-paragraph-number">10.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::is_proper_constructor</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Kinds::arity_of_constructor</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">t</span><span class="plain-syntax"> += </span><a href="5-ptd2.html#SP10" class="function-link"><span class="function-syntax">ParsingIDTypeData::find_kind_variable_domains</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Kinds::unary_construction_material</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">), </span><span class="identifier-syntax">usages</span><span class="plain-syntax">, </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">Y</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Kinds::binary_construction_material</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">X</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">Y</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">t</span><span class="plain-syntax"> += </span><a href="5-ptd2.html#SP10" class="function-link"><span class="function-syntax">ParsingIDTypeData::find_kind_variable_domains</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">usages</span><span class="plain-syntax">, </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">t</span><span class="plain-syntax"> += </span><a href="5-ptd2.html#SP10" class="function-link"><span class="function-syntax">ParsingIDTypeData::find_kind_variable_domains</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Y</span><span class="plain-syntax">, </span><span class="identifier-syntax">usages</span><span class="plain-syntax">, </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10_1" class="paragraph-anchor"></a><b>&#167;10.1. </b>We count how many times each variable appears. It should be given a domain
in exactly one place: for example,
</p>

<blockquote>
    <p>To amaze (alpha - an arithmetic value of kind K) with (beta - an enumerated value of kind K): ...</p>
</blockquote>

<p class="commentary">produces the following problem, because the domain of K has been given twice.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">A kind variable has been found</span><span class="named-paragraph-number">10.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">usages</span><span class="plain-syntax">[</span><span class="identifier-syntax">N</span><span class="plain-syntax">]++;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dec</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Kinds::get_variable_stipulation</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dec</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">declarations</span><span class="plain-syntax">[</span><span class="identifier-syntax">N</span><span class="plain-syntax">]) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_DoublyDeclaredKindVariable</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this phrase declares the same kind variable more than once"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"and ought to declare each variable once each."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">declarations</span><span class="plain-syntax">[</span><span class="identifier-syntax">N</span><span class="plain-syntax">] = </span><span class="identifier-syntax">dec</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP10">&#167;10</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>The syntax for the body of a phrase definition is that it's a sequence of
fixed single words, which are not brackets, and bracketed token definitions,
occurring in any quantity and any order. For example:
</p>

<blockquote>
    <p>begin the (A - activity on value of kind K) activity with (val - K)</p>
</blockquote>

<p class="commentary">is a sequence of word, word, token, word, word, token.
</p>

<p class="commentary">For implementation convenience, we write a grammar which splits off the next
piece of the definition from the front of the text. In production (e), it's
a single word; in production (b), a token definition; and the others all
give problems for misuse of brackets.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;phrase-definition-word-or-token&gt;</span>
<span class="plain-syntax">    ( ) *** |</span>
<span class="plain-syntax">    ( </span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax"> ) *** |</span>
<span class="plain-syntax">    ( *** |</span>
<span class="plain-syntax">    ) *** |</span>
<span class="plain-syntax">    ### ***</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11_1" class="paragraph-anchor"></a><b>&#167;11.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_TokenWithEmptyBrackets</span><span class="named-paragraph-number">11.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TokenWithEmptyBrackets</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"nothing is between the opening bracket '(' and its matching close bracket ')'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"so I can't see what is meant to be the fixed text and what is meant to be "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"changeable. The idea is to put brackets around whatever varies from one "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"usage to another: for instance, 'To contribute (N - a number) dollars: ...'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP11">&#167;11</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11_2" class="paragraph-anchor"></a><b>&#167;11.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_TokenWithoutCloseBracket</span><span class="named-paragraph-number">11.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TokenWithoutCloseBracket</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"the opening bracket '(' has no matching close bracket ')'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"so I can't see what is meant to be the fixed text and what is meant to be "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"changeable. The idea is to put brackets around whatever varies from one "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"usage to another: for instance, 'To contribute (N - a number) dollars: ...'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP11">&#167;11</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP11_3" class="paragraph-anchor"></a><b>&#167;11.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_TokenWithoutOpenBracket</span><span class="named-paragraph-number">11.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TokenWithoutOpenBracket</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"a close bracket ')' appears here with no matching open '('"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"so I can't see what is meant to be the fixed text and what is meant to be "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"changeable. The idea is to put brackets around whatever varies from one usage "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"to another: for instance, 'To contribute (N - a number) dollars: ...'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP11">&#167;11</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b>Phrase token declarations allow a variety of non-standard constructs.
</p>

<p class="commentary">Note that nested brackets are allowed in the kind indication after
the hyphen, and this is sorely needed with complicated functional kinds.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;phrase-token-declaration&gt;</span>
<span class="plain-syntax">    *** ( *** - ...... |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">nonexisting</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">nonexisting</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">nonexisting</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">that</span><span class="plain-syntax">/</span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">varies</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">nonexisting</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">nonexisting</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">nonexisting</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">that</span><span class="plain-syntax">/</span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">varies</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - {</span><span class="identifier-syntax">an</span><span class="plain-syntax"> </span><span class="identifier-syntax">existing</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    ...... - {</span><span class="identifier-syntax">an</span><span class="plain-syntax"> </span><span class="identifier-syntax">existing</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    ...... - {</span><span class="identifier-syntax">an</span><span class="plain-syntax"> </span><span class="identifier-syntax">existing</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">that</span><span class="plain-syntax">/</span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">varies</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    ...... - {</span><span class="identifier-syntax">existing</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    ...... - {</span><span class="identifier-syntax">existing</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">variable</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    ...... - {</span><span class="identifier-syntax">existing</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">that</span><span class="plain-syntax">/</span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">varies</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">condition</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">condition</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">phrase</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">phrase</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">storage</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">storage</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-prototype&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="reserved-syntax">table</span><span class="plain-syntax">-</span><span class="identifier-syntax">reference</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="reserved-syntax">table</span><span class="plain-syntax">-</span><span class="identifier-syntax">reference</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="function-syntax">&lt;s-phrase-token-type&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - </span><span class="function-syntax">&lt;s-kind-as-name-token&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...... - ...... |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;s-kind-as-name-token&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ......</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12_1" class="paragraph-anchor"></a><b>&#167;12.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">New local</span><span class="named-paragraph-number">12.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">, </span><span class="identifier-syntax">Specifications::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP12_2" class="paragraph-anchor"></a><b>&#167;12.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">New local of kind</span><span class="named-paragraph-number">12.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">NEW_LOCAL_IDTC</span><span class="plain-syntax">, </span><span class="identifier-syntax">Specifications::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1]) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a> (four times).</li></ul>
<p class="commentary firstcommentary"><a id="SP12_3" class="paragraph-anchor"></a><b>&#167;12.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Existing local</span><span class="named-paragraph-number">12.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">OLD_LOCAL_IDTC</span><span class="plain-syntax">, </span><a href="5-ptd2.html#SP14" class="function-link"><span class="function-syntax">ParsingIDTypeData::match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP12_4" class="paragraph-anchor"></a><b>&#167;12.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Existing local of kind</span><span class="named-paragraph-number">12.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">OLD_LOCAL_IDTC</span><span class="plain-syntax">, </span><a href="5-ptd2.html#SP14" class="function-link"><span class="function-syntax">ParsingIDTypeData::match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a> (four times).</li></ul>
<p class="commentary firstcommentary"><a id="SP12_5" class="paragraph-anchor"></a><b>&#167;12.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Storage</span><span class="named-paragraph-number">12.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">STORAGE_IDTC</span><span class="plain-syntax">, </span><a href="5-ptd2.html#SP14" class="function-link"><span class="function-syntax">ParsingIDTypeData::match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_6" class="paragraph-anchor"></a><b>&#167;12.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Storage of kind</span><span class="named-paragraph-number">12.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">STORAGE_IDTC</span><span class="plain-syntax">, </span><a href="5-ptd2.html#SP14" class="function-link"><span class="function-syntax">ParsingIDTypeData::match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_7" class="paragraph-anchor"></a><b>&#167;12.7. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Table ref</span><span class="named-paragraph-number">12.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">TABLE_REF_IDTC</span><span class="plain-syntax">, </span><a href="5-ptd2.html#SP14" class="function-link"><span class="function-syntax">ParsingIDTypeData::match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">K_value</span><span class="plain-syntax">, </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP12_8" class="paragraph-anchor"></a><b>&#167;12.8. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_TokenWithNestedBrackets</span><span class="named-paragraph-number">12.8</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TokenWithNestedBrackets</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"the name of the token inside the brackets '(' and ')' and before the hyphen '-' "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"itself contains another open bracket '('"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"which is not allowed."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ERRONEOUS_IDTC</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax"> };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_9" class="paragraph-anchor"></a><b>&#167;12.9. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_BadTypeIndication</span><span class="named-paragraph-number">12.9</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-token-declaration&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_BadTypeIndication</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="string-syntax">"In %1, the text '%2' after the hyphen should tell me what kind of value goes here "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"(like 'a number', or 'a vehicle'), but it's not something I recognise."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ERRONEOUS_IDTC</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax"> };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_10" class="paragraph-anchor"></a><b>&#167;12.10. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_TokenMisunderstood</span><span class="named-paragraph-number">12.10</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_TokenMisunderstood</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"the brackets '(' and ')' here neither say that something varies but has a given "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"type, nor specify a called name"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"so I can't make sense of them. For a 'To...' phrase, brackets like this are used "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"with a hyphen dividing the name for a varying value and the kind it has: for "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"instance, 'To contribute (N - a number) dollars: ...'. Rules, on the other hand, "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"use brackets to give names to things or rooms found when matching conditions: "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"for instance, 'Instead of opening a container in the presence of a man (called "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"the box-watcher): ...'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ERRONEOUS_IDTC</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax"> };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="5-ptd2.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>This nonterminal simply wraps &lt;k-kind-as-name-token&gt; up as a specification.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;s-kind-as-name-token&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> = </span><span class="identifier-syntax">kind_parsing_mode</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind_parsing_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">PHRASE_TOKEN_KIND_PARSING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;k-kind-as-name-token&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind_parsing_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">s</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">t</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        ==&gt; { </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><a href="5-ptd2.html#SP14" class="function-link"><span class="function-syntax">ParsingIDTypeData::match</span></a><span class="plain-syntax">(</span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">) };</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    ==&gt; { </span><span class="identifier-syntax">fail</span><span class="plain-syntax"> </span><span class="identifier-syntax">nonterminal</span><span class="plain-syntax"> };</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">ParsingIDTypeData::match</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">ParsingIDTypeData::match</span></span>:<br/><a href="5-ptd2.html#SP12_3">&#167;12.3</a>, <a href="5-ptd2.html#SP12_4">&#167;12.4</a>, <a href="5-ptd2.html#SP12_5">&#167;12.5</a>, <a href="5-ptd2.html#SP12_6">&#167;12.6</a>, <a href="5-ptd2.html#SP12_7">&#167;12.7</a>, <a href="5-ptd2.html#SP13">&#167;13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Specifications::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Node::set_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="5-ptd.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresschapter"><a href="2-bv.html">2</a></li><li class="progresschapter"><a href="3-dlr.html">3</a></li><li class="progresschapter"><a href="4-nr.html">4</a></li><li class="progresscurrentchapter">5</li><li class="progresssection"><a href="5-id.html">id</a></li><li class="progresssection"><a href="5-idf.html">idf</a></li><li class="progresssection"><a href="5-adf.html">adf</a></li><li class="progresssection"><a href="5-tpf.html">tpf</a></li><li class="progresssection"><a href="5-ptd.html">ptd</a></li><li class="progresscurrent">ptd2</li><li class="progresssection"><a href="5-po.html">po</a></li><li class="progresssection"><a href="5-rf.html">rf</a></li><li class="progresssection"><a href="5-rcd.html">rcd</a></li><li class="progresschapter"><a href="6-rls.html">6</a></li><li class="progresschapter"><a href="7-tc.html">7</a></li><li class="progresschapter"><a href="8-kpr.html">8</a></li><li class="progressnext"><a href="5-po.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

